﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class HTTPRedirect : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        //if (Request.ServerVariables["SERVER_PORT"].ToString() == "80")
        //{
        //    string strSecureURL;
        //    //strSecureURL = "https://";
        //    strSecureURL = Request.Url.ToString().Replace("http:", "https:");

        //    Response.Redirect(strSecureURL);
        //    //Response.Write(strSecureURL);
        //}
        //Image1.ImageUrl = "http://www.comparexpress.com/images/header/Comparexpresslogo.gif";
        hplRedirectLink.NavigateUrl = "http://www.comparexpress.com/";

        try
        {

            if (Request.QueryString.Count > 0)
            {
                string _tempUrl = Request.QueryString[0];
                _tempUrl = _tempUrl.Replace("403;", "");
                _tempUrl = _tempUrl.Replace(":80", "");
                _tempUrl = _tempUrl.Replace("http:", "https:");
                hplTryWithSSL.NavigateUrl = _tempUrl;
            }
        }
        catch(Exception Ex)
        {
            Ex = null;
        }

        //if (Request.Params["aspxerrorpath"] != null)
        //{
        //    string _trySSLPath = Request.ServerVariables["SERVER_NAME"] + Request.Params["aspxerrorpath"].ToString();
        //    if (_trySSLPath.Contains("http"))
        //    {
        //        _trySSLPath = _trySSLPath.Replace("http:", "https:");
        //    }
        //    else
        //    {
        //        _trySSLPath = "https://" + _trySSLPath;
        //    }
        //    Response.Write(Request.Params["aspxerrorpath"].ToString());
        //    hplTryWithSSL.NavigateUrl = _trySSLPath;
        //}
        //else
        //{

        //}
    }
}
